<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>预览PDF - 原生</title>
    <style>
        body,html{
            margin:0;
        }
    </style>
</head>
<body>
    <div id="pdf-container" style="height: 600px;"></div>
    <script>
        (function(){
            function pdfViewer(id,pdfUrl){
                var iframe = document.createElement('iframe');
                var ele = document.getElementById(id);
                ele.appendChild(iframe);
                iframe.setAttribute('src',pdfUrl);
                iframe.setAttribute('width','100%');
                iframe.setAttribute('height','100%');
                iframe.setAttribute('frameborder',0); 
            }
            pdfViewer('pdf-container','./assets/test.pdf');
        })();
    </script>
</body>
</html>